//
//  main.m
//  08-homework
//
//  Created by Snow on 16/7/13.
//  Copyright © 2016年 Snow. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "Star.h"
#import "Singer.h"
#import "Teacher.h"
#import "Student.h"
#import "NSMutableArray+Convert.h"

int main(int argc, const char * argv[]) {
    /* iOS9新特性三块的深入理解, 创建几个类, 熟悉写法(提交练习成果)
     iOS 类扩展方式的复习 1> 给NSMutableArray添加convert方法，实现数组倒序。
     预习UI内容 */
    
    /* nonnull.__nullable.null_resettable */
    Star *star1 = [[Star alloc] init];
//    star1 setName:<#(NSString * _Nonnull)#>
    star1.name = nil;
    
    Star *star2 = [[Star alloc] init];
//    star2 setTvShow:<#(NSString * _Nullable)#>
    star2.tvShow = nil;
    
    Star *star3 = [[Star alloc] init];
//    star3 setArrayOfTV:<#(NSMutableArray * _Nullable)#>
    [star3 arrayOfTV];
    
    /* 泛型 */
    //1.数组 字典 轻量级泛型
    NSMutableArray<Star *> *arrayOfStar = [NSMutableArray array];
//    arrayOfStar addObject:<#(nonnull Star *)#>
    [arrayOfStar addObject:star1];
    [arrayOfStar addObject:@"123"];
    
    NSMutableDictionary<NSString *, Singer *> *dicOfSinger = [NSMutableDictionary dictionaryWithObjectsAndKeys:star1, @"李光洙",star2, @"IU", nil];
//[dicOfSinger setObject:, forKey:<#(nonnull id<NSCopying>)#>]
    [dicOfSinger setObject:@"假明星" forKey:@"王道林"];

    //2.自定义泛型
    Teacher<Star *> *tea = [[Teacher alloc] init];
    [tea addTeacherNameObject:star1];
    Teacher<Singer *> *teacher = [[Teacher alloc] init];
//    [tea addTeacherNameObject:<#(Star *)#>]
//    teacher addTeacherNameObject:<#(Singer *)#>
    Singer *singer = [[Singer alloc] init];
    [tea addTeacherNameObject:singer];
    [teacher addTeacherNameObject:star3];
    
    //3.协变性 逆变性
    Student *stu = [[Student alloc] init];
    Student<NSArray *> *stu1 = [[Student alloc] init];
    Student<NSMutableArray *> *stu2 = [[Student alloc] init];
    stu = stu1;
    stu = stu2;
    stu1 = stu;
    stu2 = stu;
    
    stu1 = stu2;
    stu2 = stu1;
    
    /* __kindof */
    Student *student = [[Student alloc] init];
    NSMutableArray *arr = (NSMutableArray *)[student getChar];
    NSArray *arr1 = [student getChar];
    
    
    /* 给NSMutableArray添加convert方法，实现数组倒序 */
    NSMutableArray *mArr = [NSMutableArray arrayWithObjects:@"lisi", @"zhangsan", @"wangwu", nil];
    [mArr Convert];
    return 0;
}
